package BaseObject;

/**
 * ClassName: RecursionExercise01
 * Package: MyArray
 * Description: 利用递归求解斐波那契数列
 *
 * @Author Linshio
 * @Create 2025/3/9 21:37
 */
public class RecursionExercise01 {
    public static void main(String[] args) {
        System.out.println("feiBo(7) = " + feiBo(7));
    }

    public static int feiBo(int num) {
        if (num == 1 || num == 2) {
            return 1;
        } else {
            return feiBo(num - 1) + feiBo(num - 2);
        }
    }
}
